package com.groupten.Controller;

import com.groupten.Entity.ConfigureRuleEntity;
import com.groupten.Service.ConfigureRuleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Slf4j
@RestController
@RequestMapping("group10/configurerule")
public class ConfigureRuleController {

    @Autowired
    private ConfigureRuleService configureRuleService;

    @RequestMapping("insert")
    public String insert(@RequestBody ConfigureRuleEntity configureRuleEntity){
        return configureRuleService.insert(configureRuleEntity);
    }

    @RequestMapping("update")
    public String update(@RequestBody Map<String,String> newData){
        return configureRuleService.updateByName(newData.get("ruleName"), newData);
    }

}
